<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QWebDatabase Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QWebDatabase Class Reference<br /><sup><sup>[<a href="qtwebkit.html">QtWebKit</a> module]</sup></sup></h1><p>The QWebDatabase class provides access to HTML 5 databases
created with JavaScript. <a href="#details">More...</a></p>

<h3>Methods</h3><ul><li><div class="fn" /><b><a href="qwebdatabase.html#QWebDatabase">__init__</a></b> (<i>self</i>, QWebDatabase&#160;<i>other</i>)</li><li><div class="fn" />QString <b><a href="qwebdatabase.html#displayName">displayName</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qwebdatabase.html#expectedSize">expectedSize</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qwebdatabase.html#fileName">fileName</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qwebdatabase.html#name">name</a></b> (<i>self</i>)</li><li><div class="fn" />QWebSecurityOrigin <b><a href="qwebdatabase.html#origin">origin</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qwebdatabase.html#size">size</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" /><b><a href="qwebdatabase.html#removeAllDatabases">removeAllDatabases</a></b> ()</li><li><div class="fn" /><b><a href="qwebdatabase.html#removeDatabase">removeDatabase</a></b> (QWebDatabase&#160;<i>db</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QWebDatabase class provides access to HTML 5 databases
created with JavaScript.</p>
<p>The upcoming HTML 5 standard includes support for SQL databases
that web sites can create and access on a local computer through
JavaScript. QWebDatabase is the C++ interface to these
databases.</p>
<p>Databases are grouped together in security origins. To get
access to all databases defined by a security origin, use <a href="qwebsecurityorigin.html#databases">QWebSecurityOrigin.databases</a>().
Each database has an internal <a href="qwebdatabase.html#name">name</a>(), as well as a user-friendly
name, provided by <a href="qwebdatabase.html#displayName">displayName</a>(). These names are
specified when creating the database in the JavaScript code.</p>
<p>WebKit uses SQLite to create and access the local SQL databases.
The location of the database file in the local file system is
returned by <a href="qwebdatabase.html#fileName">fileName</a>().
You can access the database directly through the <a href="qtsql.html">QtSql</a> database module.</p>
<p>For each database the web site can define an <a href="qwebdatabase.html#expectedSize">expectedSize</a>(). The current
size of the database in bytes is returned by <a href="qwebdatabase.html#size">size</a>().</p>
<p>For more information refer to the <a href="http://dev.w3.org/html5/webdatabase/">HTML5 Web SQL Database Draft
Standard</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QWebDatabase" />QWebDatabase.__init__ (<i>self</i>, <a href="qwebdatabase.html">QWebDatabase</a>&#160;<i>other</i>)</h3><p>Constructs a web database from <i>other</i>.</p>


<h3 class="fn"><a name="displayName" />QString QWebDatabase.displayName (<i>self</i>)</h3><p>Returns the name of the database in a format that is suitable
for display to the user.</p>


<h3 class="fn"><a name="expectedSize" />int QWebDatabase.expectedSize (<i>self</i>)</h3><p>Returns the expected size of the database in bytes as defined by
the web author.</p>


<h3 class="fn"><a name="fileName" />QString QWebDatabase.fileName (<i>self</i>)</h3><p>Returns the file name of the web database.</p>
<p>The name can be used to access the database through the <a href="qtsql.html">QtSql</a> database module, for example:</p>
<pre class="cpp">
 <span class="type"><a href="qwebdatabase.html">QWebDatabase</a></span> webdb <span class="operator">=</span> <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
 <span class="type"><a href="qsqldatabase.html">QSqlDatabase</a></span> sqldb <span class="operator">=</span> <span class="type"><a href="qsqldatabase.html">QSqlDatabase</a></span><span class="operator">.</span>addDatabase(<span class="string">"QSQLITE"</span><span class="operator">,</span> <span class="string">"myconnection"</span>);
 sqldb<span class="operator">.</span>setDatabaseName(webdb<span class="operator">.</span>fileName());
 <span class="keyword">if</span> (sqldb<span class="operator">.</span>open()) {
     <span class="type"><a href="qstringlist.html">QStringList</a></span> tables <span class="operator">=</span> sqldb<span class="operator">.</span>tables();
     <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
 }
</pre>
<p><b>Note:</b> Concurrent access to a database from multiple
threads or processes is not very efficient because SQLite is used
as WebKit's database backend.</p>


<h3 class="fn"><a name="name" />QString QWebDatabase.name (<i>self</i>)</h3><p>Returns the name of the database.</p>


<h3 class="fn"><a name="origin" /><a href="qwebsecurityorigin.html">QWebSecurityOrigin</a> QWebDatabase.origin (<i>self</i>)</h3><p>Returns the databases's security origin.</p>


<h3 class="fn"><a name="removeAllDatabases" />QWebDatabase.removeAllDatabases ()</h3><p>Deletes all web databases in the configured offline storage
path.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qwebsettings.html#setOfflineStoragePath">QWebSettings.setOfflineStoragePath</a>().</p>


<h3 class="fn"><a name="removeDatabase" />QWebDatabase.removeDatabase (<a href="qwebdatabase.html">QWebDatabase</a>&#160;<i>db</i>)</h3><p>Removes the database <i>db</i> from its security origin. All
data stored in the database <i>db</i> will be destroyed.</p>


<h3 class="fn"><a name="size" />int QWebDatabase.size (<i>self</i>)</h3><p>Returns the current size of the database in bytes.</p>


<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;snapshot-4.9.5-9eb6aac99275 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.3</td></tr></table></div></address></body></html>